package com.chhh.cranelease.mapper;

import com.chhh.cranelease.entity.CarLog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CarLogDao {
    @Insert("insert into car_log(cl_num,cl_name,cl_outtime,cl_company,cl_days,cl_price,cl_state,cl_oilmoney) values(#{cl_num},#{cl_name},#{cl_outtime},#{cl_company},#{cl_days},#{cl_price},1,#{cl_oilmoney})")
    Integer insertCarLog(CarLog carLog);
    @Select("select * from car_log where cl_state!=5 and cl_company=#{username}")
    List<CarLog> selectAll(@Param("username") String username);
    @Select("select * from car_log where cl_id=#{id}")
    CarLog selectById(Integer id);
    @Update("update car_log set cl_state=#{cl_state} where cl_id=#{cl_id}")
    Integer updateLog(CarLog carLog);
    @Update("update car_log set cl_state=5 where cl_id=#{cl_id}")
    Integer cancelLog(CarLog carLog);
}
